*{
    padding:0;
    margin:0;
  /*   border: 1px solid black; */
}

/*渐变背景颜色*/
body{
    height:100vh;
    background: linear-gradient(#99f,#f99);
}

/*div块居中且布局模式为flex模式*/
body,
.navbar, 
.navbar ul{
    display:flex;
    justify-content:center;
    align-items: center;
}

/*导航框的*/
.navbar{
    position:relative;
    padding: 20px;
    border-radius:50px;
    background-color:#fff;
}

/*复选框*/
.navbar input{
    width:40px;
    height:40px;
    cursor:pointer;
    opacity:0;
}

.navbar span{
    position:absolute;
    left:24.35px;
    top:calc(50% - 10px);
    width:30px;
    height:4px;
    border-radius:15px;
    background-color: #999;
    pointer-events:none;
    /*复选框来回的操作*/
    transition:top 0.3s ease-in-out 0.3s,transform 0.3s ease-in-out;
}

.navbar span:nth-child(3){
    top:calc(50% + 6px);
}


.navbar ul{
    width:0;
    /*溢出隐藏*/
    overflow:hidden;
   /*防止换行*/
    white-space:nowrap;
    transition:all 0.5s; 
}


.navbar ul li{
    list-style:none;
    margin:0px 14px;
}

.navbar ul li a{
    text-decoration:none;
    font-size:20px;
    font-weight:800px;
    color:#333;
}

.navbar ul li a:hover{
    color:#fb7299;
}


/*以下是被选中的复选框的操作*/
/*临时自学兄弟选择器:https: //zhuanlan.zhihu.com/p/415306911?utm_id=0
    此方案解决了导航栏怎么打开的问题。
*/
.navbar input:checked ~ ul{
    width:380px;
}


.navbar input:checked ~ span:nth-child(2) {
    top: calc(50% - 2px);
    transform: rotate(-45deg);
    background-color: #fb7299;
    transition: top 0.3s ease-in-out, transform 0.3s ease-in-out 0.3s;
}

.navbar input:checked ~ span:nth-child(3) {
    top: calc(50% - 2px);
    transform: rotate(45deg);
    background-color: #fb7299;
    transition: top 0.3s ease-in-out, transform 0.3s ease-in-out 0.3s;
}

